{% extends "Site1Bundle:Module:layout" %}
{% block content %}
 <table border="1">
    <thead>
        <th>
            #
        </th>
{% for plugin in module %}
        <th {% if plugin.getFields()|length > 1 %} colspan="{{ plugin.getFields()|length }}" {% endif %} >
            {{ plugin.getTitle() }}
        </th>
{% endfor %}
        <th>
            <a href="{% route module.getRoute('create') %}">Создать</a>
        </th>
    </thead>
    <tbody>
{% for datarow in module.data %}
        <tr>
            <td>{{ datarow.id }}</td>
    {% for plugin in module %}
        {% for field in plugin %}         
            <td>
                {{ plugin.getFieldValue(field, datarow)}}
            </td>
        {% endfor %}
    {% endfor %}
            <td>
                <a href="{% route module.getRoute('edit') with ['id': datarow.id] %}">Редактировать</a>
                <br />
                <a href="{% route module.getRoute('delete') with ['id': datarow.id] %}">Удалить</a>
                <br />
    {% if not datarow.hidden %}
                <a href="{% route module.getRoute('hide') with ['id': datarow.id] %}">Скрыть</a>
    {% else %}
                <a href="{% route module.getRoute('show') with ['id': datarow.id] %}">Показать</a>
    {% endif %}
        </td>
{% endfor %}
    </tbody>
</table>
{% endblock %}